#ifndef DATAPLATFORM_PERF
#define DATAPALTFORM_PERF

#include <stdio.h>

#define THREAD_MAX_NUM    20

#define SINGLE_THREAD     1
#define MULTIPLE_THREAD    2
#define THREAD_POOL       3

typedef struct _table_item
{
   char name[1024];
   struct _table_item *next;

}TableItem;

typedef struct testconf
{
    unsigned char mode;
    int           work_thread_nums;
    int           producer_thread_nums;
    int           dcount_per_producer;
    int           lines_per_data;
    int           itemsize;
    int           qsize;
    char          tname[1024];
    TableItem     *head;
}TestConf;


typedef struct _queue_item
{
    char *json;
    struct _queue_item *next;
}QueueItem;

typedef struct _queue
{
    int                        size;
    pthread_mutex_t            lock;
    pthread_cond_t             cond_full;
    pthread_cond_t             cond_empty;
    QueueItem                  *head;
    volatile int               is_over;
    int                        dcount;
}SafeQueue;

typedef struct _timeitem
{
    long long timediff;
    struct _timeitem *next;
}Titem;

SafeQueue *safequeue_create();
void      safequeue_destroy(SafeQueue *q);
int       safequeue_put(SafeQueue *q, char *jstr);
QueueItem *safequeue_get(SafeQueue *q);

int insert();
extern SafeQueue *sq;
extern TestConf  *tf;

#endif
